package com.ce.pms.occupation;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import com.ce.pms.DBUnitTool;
import com.ce.pms.exception.BusinessException;
import com.ce.pms.occupation.dao.IPerfectItemTrackDao;
import com.ce.pms.occupation.service.IPerfectItemTrackService;
import com.ce.pms.occupation.vo.PerfectItemTrackVO;
import com.ce.util.BeanUtil;
import com.sitechasia.webx.core.support.Page;
/**
 * 功能描述: 整改项目跟进Service功能测试类
 * <p>版权所有：中企动力
 * <p>未经本公司许可，不得以任何方式复制或使用本程序任何部分
 *
 * @author  胡煦
 * Create on:2008-12-31
 * Edit author:
 * Edit on:
 * 修改原因：

 */

public class PerfectItemTrackServiceImplT extends DBUnitTool {

	/**
	 * 方法描述: 分页查询所有整改跟进
	 * @author 胡煦
	 * Create on:2008-12-29
	 * @param SearchVO
	 * @return 返回当前页的查询结果
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public void testQueryPerfectItemTrackVOByPage(){
		PerfectItemTrackVO searchVO = new PerfectItemTrackVO();
		Page page = perfectItemTrackService.queryPerfectItemTrackVOByPage(searchVO);
		Assert.assertNotNull(page.getResult());
	}

	/**
	 * 方法描述: 根据ID查询整改跟进VO
	 * @author 胡煦
	 * Create on:2008-12-29
	 * @param id
	 * @return 返回当前页的查询结果
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public void testQueryPerfectItemTrackVOById(){
		Long id = 1l;
		PerfectItemTrackVO perfectItemTrackVO = new PerfectItemTrackVO();
		perfectItemTrackVO = perfectItemTrackService.queryPerfectItemTrackVOById(id);
		Assert.assertNotNull(perfectItemTrackVO);
	}


	/**
	 * 方法描述: 增加整改跟进方法
	 * @author 胡煦
	 * Create on:2008-12-30
	 * @param perfectItemTrackVO
	 * @return PerfectItemTrackVO
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	@Test
	public void testAddPerfectItemTrack(){
		PerfectItemTrackVO perfectItemTrackVO = new PerfectItemTrackVO();
		perfectItemTrackVO.setDescription("测试三");
		perfectItemTrackVO.setPerfectItemRequisitionId(4l);
		perfectItemTrackVO.setTrackDate(perfectItemTrackService.getDate());
		perfectItemTrackVO.setTrackerId(1l);
		try {
			perfectItemTrackVO = perfectItemTrackService.addPerfectItemTrack(perfectItemTrackVO);
			BeanUtil.printfInfo(perfectItemTrackVO, true);
			Assert.assertNotNull(perfectItemTrackVO);
		} catch (BusinessException e) {
			e.printStackTrace();
			super.dealBusinessException(e, "occupation:occupation_perfectItemTrack_add_exception");
		}
	}
	/**
	 * 方法描述: 新增整改跟进验证方法
	 * @author 胡煦
	 * Create on:2008-12-31
	 * @param perfectItemRequisitionId
	 * @return void
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public void testCheckAddIsTrue(){
		Long perfectItemRequisitionId = 1l;
		try {
			perfectItemTrackService.checkAddIsTrue(perfectItemRequisitionId);
		} catch (BusinessException e) {
			e.printStackTrace();
			super.dealBusinessException(e, "occupation:occupation_perfectItemTrack_add_exception");
		}
	}

	/**
	 * 方法描述: 修改整改跟进方法
	 * @author 胡煦
	 * Create on:2008-12-30
	 * @param perfectItemTrackVO
	 * @return PerfectItemTrackVO
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public void testEditPerfectItemTrack(){
		PerfectItemTrackVO perfectItemTrackVO = new PerfectItemTrackVO();
		try {
			perfectItemTrackVO = perfectItemTrackService.editPerfectItemTrack(perfectItemTrackVO);
		} catch (BusinessException e) {
			e.printStackTrace();
			Assert.fail("抛出异常");
		}
	}
	/**
	 * 方法描述: 删除整改跟进方法
	 * @author 胡煦
	 * Create on:2008-12-30
	 * @param perfectItemTrackId
	 * @return boolean
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public void testDeletePerfectItemTrack(){
		Long perfectItemTrackId = 1l;
		try {
			boolean l = perfectItemTrackService.deletePerfectItemTrack(perfectItemTrackId);
		} catch (BusinessException e) {
			e.printStackTrace();
			super.dealBusinessException(e, "occupation:system_delete_inused_exception");
		}
	}
	/**
	 * 方法描述: 整改跟进完工验证方法
	 * @author 胡煦
	 * Create on:2008-12-31
	 * @param perfectItemTrackVO
	 * @return void
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public void testCheckCompleteIsTrue(){
		PerfectItemTrackVO perfectItemTrackVO = new PerfectItemTrackVO();
		try {
			perfectItemTrackService.checkCompleteIsTrue(perfectItemTrackVO);
		} catch (RuntimeException e) {
			e.printStackTrace();
			Assert.fail("抛出异常");
		}
	}
	private static IPerfectItemTrackService perfectItemTrackService;
	private static IPerfectItemTrackDao perfectItemTrackDao;
	/**
    *
    * 功能描述:   <br>
    *
    * Create author：胡煦  <br>
    * Create on:2008-12-17  <br>
    * Edit author：  <br>
    * Edit on:    <br>
    * Why:     <br>
    */
	@BeforeClass
	public static void initIPerfectItemTrack(){
		if (perfectItemTrackService == null) {
			perfectItemTrackService = (IPerfectItemTrackService)DBUnitTool.applicationContext.getBean("perfectItemTrackService");
		}
		if (perfectItemTrackDao == null) {
			perfectItemTrackDao = (IPerfectItemTrackDao)DBUnitTool.applicationContext.getBean("perfectItemTrackDao");
		}
	}
}
